<?php
// src/Inter/Article/DataFixtures/ORM/LoadArticleData.php

namespace Inter\ArticleBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Inter\ArticleBundle\Entity\Article;

class LoadArticleData extends AbstractFixture implements OrderedFixtureInterface
{
	/**
	 * {@inheritDoc}
	 */
	public function load(ObjectManager $manager)
	{
		for($i=0;$i<10;$i++)
		{
			$article = new Article();
			
			$article->setTitle('This is test article ' . $i);
			$article->setDescription('This is description for test article ' . $i);
			$article->setContent('This is content for article ' . $i);
			$article->setCreatedat(new \DateTime());
			
			$article->setAuthor($this->getReference('user'));
			
			$manager->persist($article);
		}
		
		
		$manager->flush();	
	}
	
	/**
	 * {@inheritDoc}
	 */
	public function getOrder()
	{
		return 2;
	}
}